package cn.calm.commons.entity;

import java.util.List;

public class PageMode {
	private Integer pageSize;
	private Integer currentPage;
	private Long totalPage;
	private List<? extends BaseEntity> data;
	private Long totalCount;
	public Integer getPageSize() {
		if(pageSize==null){
			return 10;
		}
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getCurrentPage() {
		if(currentPage==null){
			return 1;
		}
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public Long getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Long totalPage) {
		this.totalPage = totalPage;
	}

	public List<? extends BaseEntity> getData() {
		return data;
	}

	public void setData(List<? extends BaseEntity> data) {
		this.data = data;
	}
	
	public Integer getStartRow(){
		return (int) ((getCurrentPage()-1)*getPageSize());
	}
	
	public Long getEndRow(){
		return (long) (getCurrentPage()*getPageSize());
	}

	public Long getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(Long totalCount) {
		this.totalCount = totalCount;
	}
	
}
